<?php

namespace App\Facades;

class SrcCrypt
{
    public function encode($filepath)
    {
        if ($fp = fopen($filepath, 'rb+') && $fileSize = filesize($filepath)) {
            $data = tonyenc_encode(fread($fp, $fileSize));
            if ($data !== false) {
                if (file_put_contents($filepath, '') !== false) {
                    rewind($fp);
                    fwrite($fp, $data);
                }
            }
            fclose($fp);
        }
    }

    public function decode($filepath)
    {

    }

    public function tonyenc_decode($data,$size){

    }
}
